package JaggSoft.Utilidades;

import java.awt.event.*;
import javax.swing.*;

public class EditorCelda extends DefaultCellEditor {
    public EditorCelda(JTextField jtf) {
        super(jtf);
        jtf.setHorizontalAlignment(JTextField.CENTER);
        jtf.addKeyListener(new KeyAdapter() {
            @Override
            public void keyTyped(KeyEvent evt) {
                if(!Util.esNumero(((JTextField)getComponent()).getText()+evt.getKeyChar(),false))
                    evt.consume();
            }
        });
    }
}